﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Helpers.Converters
{
    public class StringToVisibility : DependencyObject, IValueConverter
    {
        #region Properties
        #endregion

        #region Methods

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string stringValue = (string)value;
            string stringParameter = (string)parameter; 

            return (stringValue == stringParameter)
                       ? "Visible"
                       : "Collapsed";
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (parameter.Equals("Visible") == true)
                return true;
            else if (parameter.Equals("Collapsed") == true)
                return false;
            else
                return DependencyProperty.UnsetValue;
        }

        #endregion
    }
}
